const text = 'hello world'     //声明常量

let name1 = 'jack'      //声明变量

console.log(text + ',' + name1)

function funName(params){
    console.log(text + ',' + name1);

    console.log(params)
}

//数字
const num  = 1

//字符串
const str = 'abc'

//布尔
const bl = true

//对象
const obj={
    name2 : 'jack',
    age : 2,
}

//数组
const arr = [1,2,4,6]

/*
function handleClick(e){
    console.log(e)
    e.target.style.color = 'red'

    const circleElem = document.getElementById('circleId')
    console.log(circleElem);
    if(circleElem.classList.contains('circle-show'))
    {
        circleElem.className = 'circle'
    }else{
        circleElem.classList.add('circle-show')
    }
}
*/


const getUserInfo = function(){
    console.log('getUserInfo')
    axios.get('http://127.0.0.1:3000/user').then((res) => {
        console.log(res.data);
        document.getElementById('name').innerText = res.data.name
        document.getElementById('age').innerText = res.data.age
        document.getElementById('avatar').src = 'data:image/*;base64,' + res.data.avatar
    }).catch((err) =>{console.error(err)})
}

const buttonElem = document.getElementById('button')
buttonElem.addEventListener('click',getUserInfo)
